C++ = g++

CCFLAGS = -fPIC -Wall -Wextra -DAMD64 -finline-functions -g -O0 -fno-strict-aliasing -fvisibility=hidden

OBJS = api.o buffer.o cache.o ccc.o channel.o common.o core.o epoll.o list.o md5.o packet.o queue.o window.o
OBJS1 = test.o
DIR = $(shell pwd)

all: libtest.so libudt.so libudt.a udt

%.o: %.cpp
	$(C++) $(CCFLAGS) $< -c

libudt.so: $(OBJS)
	$(C++) $^ -shared -fPIC -Wl,-rpath=./ -L./ -lpthread -o $@ 

libtest.so: $(OBJS1)
	$(C++) $^ -shared -fPIC -Wl,-rpath=./ -L./ -lpthread -o $@ 

libudt.a: $(OBJS)
	ar -rcs $@ $^

udt:
	cp udt.h udt

clean:
	rm -f *.o *.so *.dylib *.a udt

install:
	export LD_LIBRARY_PATH=$(DIR):$$LD_LIBRARY_PATH
